package com.ruoyi.common.base.biz.service.biz.v2;

import com.github.pagehelper.PageInfo;
import com.ruoyi.common.base.biz.service.base.BaseService;
import com.ruoyi.common.base.biz.service.extend.BaseExtendService;
import com.ruoyi.common.core.domain.BizBaseEntity;
import com.ruoyi.common.utils.paging.PageInfoUtils;

/**
 * BaseBizServiceImpl
 *
 * @author HHKJ-SERVER-ZJ
 * @since 2024/1/25 12:00
 */
public class BaseBizServiceImpl
        <E extends BizBaseEntity, Req extends Do, Res extends Po, Do extends E, Po extends E,
                S extends BaseService<E, Do, Po>, ExtendS extends BaseExtendService<E, Do, Po>>
        extends com.ruoyi.common.base.biz.service.biz.BaseBizServiceImpl<E, Req, Res, Do, Po, S, ExtendS> {

    @Override
    public PageInfo<Res> paging(Req req) {
        this.beforePage(req);
        PageInfo<Po> pageInfoPo = this.getService().pagingPoByDo(req);
        PageInfo<Res> pageInfoRes = PageInfoUtils.toPageInfoRes(pageInfoPo, resClass);
        this.afterPage(pageInfoRes.getList());
        return pageInfoRes;
    }
}
